home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / foodf.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  9KB  |  289 lines

  1. /***************************************************************************
  2.  
  3. Food Fight Memory Map
  4. -----------------------------------
  5.  
  6. driver by Aaron Giles
  7.  
  8. Function                           Address        R/W  DATA
  9. -------------------------------------------------------------
  10. Program ROM                        000000-00FFFF  R    D0-D15
  11. Program RAM                        014000-01BFFF  R/W  D0-D15
  12. Motion Object RAM                  01C000-01CFFF  R/W  D0-D15
  13.  
  14. Motion Objects:
  15.   Vertical Position                xxxx00              D0-D7
  16.   Horizontal Position              xxxx00              D8-D15
  17.   Picture                          xxxx10              D0-D7
  18.   Color                            xxxx10              D8-D13
  19.   VFlip                            xxxx10              D14
  20.   HFlip                            xxxx10              D15
  21.  
  22. Playfield                          800000-8007FF  R/W  D0-D15
  23.   Picture                          xxxxx0              D0-D7+D15
  24.   Color                            xxxxx0              D8-D13
  25.  
  26. NVRAM                              900000-9001FF  R/W  D0-D3
  27. Analog In                          940000-940007  R    D0-D7
  28. Analog Out                         944000-944007  W
  29.  
  30. Coin 1 (Digital In)                948000         R    D0
  31. Coin 2                                            R    D1
  32. Start 1                                           R    D2
  33. Start 2                                           R    D3
  34. Coin Aux                                          R    D4
  35. Throw 1                                           R    D5
  36. Throw 2                                           R    D6
  37. Test                                              R    D7
  38.  
  39. PFFlip                             948000         W    D0
  40. Update                                            W    D1
  41. INT3RST                                           W    D2
  42. INT4RST                                           W    D3
  43. LED 1                                             W    D4
  44. LED 2                                             W    D5
  45. COUNTERL                                          W    D6
  46. COUNTERR                                          W    D7
  47.  
  48. Color RAM                          950000-9503FF  W    D0-D7
  49. Recall                             954000         W
  50. Watchdog                           958000         W
  51. Audio 1                            A40000-A4001F  R/W  D0-D7
  52. Audio 0                            A80000-A8001F  R/W  D0-D7
  53. Audio 2                            AC0000-AC001F  R/W  D0-D7
  54.  
  55. ***************************************************************************/
  56.  
  57. #include "driver.h"
  58. #include "vidhrdw/generic.h"
  59.  
  60. extern size_t foodf_playfieldram_size;
  61. extern size_t foodf_spriteram_size;
  62.  
  63. extern unsigned char *foodf_spriteram;
  64. extern unsigned char *foodf_playfieldram;
  65.  
  66. READ_HANDLER( foodf_playfieldram_r );
  67. READ_HANDLER( foodf_nvram_r );
  68. READ_HANDLER( foodf_analog_r );
  69. READ_HANDLER( foodf_digital_r );
  70. READ_HANDLER( foodf_pokey1_r );
  71. READ_HANDLER( foodf_pokey2_r );
  72. READ_HANDLER( foodf_pokey3_r );
  73.  
  74. WRITE_HANDLER( foodf_playfieldram_w );
  75. WRITE_HANDLER( foodf_nvram_w );
  76. WRITE_HANDLER( foodf_analog_w );
  77. WRITE_HANDLER( foodf_digital_w );
  78. WRITE_HANDLER( foodf_paletteram_w );
  79. WRITE_HANDLER( foodf_pokey1_w );
  80. WRITE_HANDLER( foodf_pokey2_w );
  81. WRITE_HANDLER( foodf_pokey3_w );
  82.  
  83. void foodf_nvram_handler(void *file,int read_or_write);
  84.  
  85. int foodf_interrupt(void);
  86.  
  87. int foodf_vh_start(void);
  88. void foodf_vh_stop(void);
  89.  
  90. void foodf_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  91. void foodf_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  92.  
  93.  
  94.  
  95. READ_HANDLER( foodf_pokey1_r ) { return pokey1_r (offset/2); }
  96. READ_HANDLER( foodf_pokey2_r ) { return pokey2_r (offset/2); }
  97. READ_HANDLER( foodf_pokey3_r ) { return pokey3_r (offset/2); }
  98.  
  99. WRITE_HANDLER( foodf_pokey1_w ) { pokey1_w (offset/2, data & 0xff); }
  100. WRITE_HANDLER( foodf_pokey2_w ) { pokey2_w (offset/2, data & 0xff); }
  101. WRITE_HANDLER( foodf_pokey3_w ) { pokey3_w (offset/2, data & 0xff); }
  102.  
  103.  
  104.  
  105. static struct MemoryReadAddress foodf_readmem[] =
  106. {
  107.     { 0x000000, 0x00ffff, MRA_ROM },
  108.     { 0x014000, 0x01bfff, MRA_BANK1 },
  109.     { 0x01c000, 0x01cfff, MRA_BANK2 },
  110.     { 0x800000, 0x8007ff, foodf_playfieldram_r },
  111.     { 0x900000, 0x9001ff, foodf_nvram_r },
  112.     { 0x940000, 0x940007, foodf_analog_r },
  113.     { 0x948000, 0x948003, foodf_digital_r },
  114.     { 0x94c000, 0x94c003, MRA_NOP }, /* Used from PC 0x776E */
  115.     { 0x958000, 0x958003, MRA_NOP },
  116.     { 0xa40000, 0xa4001f, foodf_pokey1_r },
  117.     { 0xa80000, 0xa8001f, foodf_pokey2_r },
  118.     { 0xac0000, 0xac001f, foodf_pokey3_r },
  119.     { -1 }  /* end of table */
  120. };
  121.  
  122. static struct MemoryWriteAddress foodf_writemem[] =
  123. {
  124.     { 0x000000, 0x00ffff, MWA_ROM },
  125.     { 0x014000, 0x01bfff, MWA_BANK1 },
  126.     { 0x01c000, 0x01cfff, MWA_BANK2, &foodf_spriteram, &foodf_spriteram_size },
  127.     { 0x800000, 0x8007ff, foodf_playfieldram_w, &foodf_playfieldram, &foodf_playfieldram_size },
  128.     { 0x900000, 0x9001ff, foodf_nvram_w },
  129.     { 0x944000, 0x944007, foodf_analog_w },
  130.     { 0x948000, 0x948003, foodf_digital_w },
  131.     { 0x950000, 0x9501ff, foodf_paletteram_w, &paletteram },
  132.     { 0x954000, 0x954003, MWA_NOP },
  133.     { 0x958000, 0x958003, MWA_NOP },
  134.     { 0xa40000, 0xa4001f, foodf_pokey1_w },
  135.     { 0xa80000, 0xa8001f, foodf_pokey2_w },
  136.     { 0xac0000, 0xac001f, foodf_pokey3_w },
  137.     { -1 }  /* end of table */
  138. };
  139.  
  140.  
  141. INPUT_PORTS_START( foodf )
  142.     PORT_START    /* IN0 */
  143.     PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_X | IPF_PLAYER1 | IPF_REVERSE, 100, 10, 0, 255 )
  144.  
  145.     PORT_START    /* IN1 */
  146.     PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_X | IPF_PLAYER2 | IPF_REVERSE | IPF_COCKTAIL, 100, 10, 0, 255 )
  147.  
  148.     PORT_START    /* IN2 */
  149.     PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_Y | IPF_PLAYER1 | IPF_REVERSE, 100, 10, 0, 255 )
  150.  
  151.     PORT_START    /* IN3 */
  152.     PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_Y | IPF_PLAYER2 | IPF_REVERSE | IPF_COCKTAIL, 100, 10, 0, 255 )
  153.  
  154.     PORT_START    /* IN4 */
  155.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  156.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  157.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
  158.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
  159.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )
  160.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  161.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  162.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  163. INPUT_PORTS_END
  164.  
  165.  
  166.  
  167. static struct GfxLayout charlayout =
  168. {
  169.     8,8,    /* 8*8 chars */
  170.     512,    /* 512 chars */
  171.     2,        /* 2 bits per pixel */
  172.     { 0, 4 },
  173.     { 8*8+0, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3 },
  174.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  175.     8*16    /* every char takes 16 consecutive bytes */
  176. };
  177.  
  178. static struct GfxLayout spritelayout =
  179. {
  180.     16,16,    /* 16*16 sprites */
  181.     256,    /* 256 of them */
  182.     2,        /* 2 bits per pixel */
  183.     { 8*0x2000, 0 },
  184.     { 8*16+0, 8*16+1, 8*16+2, 8*16+3, 8*16+4, 8*16+5, 8*16+6, 8*16+7, 0, 1, 2, 3, 4, 5, 6, 7 },
  185.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  186.     8*32    /* every sprite takes 32 consecutive bytes */
  187. };
  188.  
  189.  
  190.  
  191. static struct GfxDecodeInfo gfxdecodeinfo[] =
  192. {
  193.     { REGION_GFX1, 0, &charlayout,   0, 64 },    /* characters 8x8 */
  194.     { REGION_GFX2, 0, &spritelayout, 0, 64 },    /* sprites & playfield */
  195.     { -1 } /* end of array */
  196. };
  197.  
  198.  
  199.  
  200. static struct POKEYinterface pokey_interface =
  201. {
  202.     3,    /* 3 chips */
  203.     600000,    /* .6 Mhz */
  204.     { 33, 33, 33 },
  205.     /* The 8 pot handlers */
  206.     { 0, 0, 0 },
  207.     { 0, 0, 0 },
  208.     { 0, 0, 0 },
  209.     { 0, 0, 0 },
  210.     { 0, 0, 0 },
  211.     { 0, 0, 0 },
  212.     { 0, 0, 0 },
  213.     { 0, 0, 0 },
  214.     /* The allpot handler */
  215.     { 0, 0, 0 }
  216. };
  217.  
  218.  
  219.  
  220. static struct MachineDriver machine_driver_foodf =
  221. {
  222.     /* basic machine hardware */
  223.     {
  224.         {
  225.             CPU_M68000,
  226.             6000000,    /* 6 Mhz */
  227.             foodf_readmem,foodf_writemem,0,0,
  228.             foodf_interrupt,4
  229.         },
  230.     },
  231.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  232.     1,
  233.     0,
  234.  
  235.     /* video hardware */
  236.     32*8, 32*8, { 0*8, 32*8-1, 0*8, 28*8-1 },
  237.     gfxdecodeinfo,
  238.     256, 256,
  239.     foodf_vh_convert_color_prom,
  240.  
  241.     VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY | VIDEO_MODIFIES_PALETTE,
  242.     0,
  243.     foodf_vh_start,
  244.     foodf_vh_stop,
  245.     foodf_vh_screenrefresh,
  246.  
  247.     /* sound hardware */
  248.     0,0,0,0,
  249.     {
  250.         {
  251.             SOUND_POKEY,
  252.             &pokey_interface
  253.         }
  254.     },
  255.  
  256.     foodf_nvram_handler
  257. };
  258.  
  259.  
  260.  
  261. /***************************************************************************
  262.  
  263.   Game driver(s)
  264.  
  265. ***************************************************************************/
  266.  
  267. ROM_START( foodf )
  268.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for 68000 code */
  269.     ROM_LOAD_EVEN( "foodf.9c",     0x00000, 0x02000, 0xef92dc5c )
  270.     ROM_LOAD_ODD ( "foodf.8c",     0x00000, 0x02000, 0xdfc3d5a8 )
  271.     ROM_LOAD_EVEN( "foodf.9d",     0x04000, 0x02000, 0xea596480 )
  272.     ROM_LOAD_ODD ( "foodf.8d",     0x04000, 0x02000, 0x64b93076 )
  273.     ROM_LOAD_EVEN( "foodf.9e",     0x08000, 0x02000, 0x95159a3e )
  274.     ROM_LOAD_ODD ( "foodf.8e",     0x08000, 0x02000, 0xe6cff1b1 )
  275.     ROM_LOAD_EVEN( "foodf.9f",     0x0c000, 0x02000, 0x608690c9 )
  276.     ROM_LOAD_ODD ( "foodf.8f",     0x0c000, 0x02000, 0x17828dbb )
  277.  
  278.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  279.     ROM_LOAD( "foodf.6lm",    0x0000, 0x2000, 0xc13c90eb )
  280.  
  281.     ROM_REGION( 0x4000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  282.     ROM_LOAD( "foodf.4d",     0x0000, 0x2000, 0x8870e3d6 )
  283.     ROM_LOAD( "foodf.4e",     0x2000, 0x2000, 0x84372edf )
  284. ROM_END
  285.  
  286.  
  287.  
  288. GAMEX( 1982, foodf, 0, foodf, foodf, 0, ROT0, "Atari", "Food Fight", GAME_NO_COCKTAIL )
  289.